<?php

function get_rand_num()
{
    return rand(100000, 999999);
}

function get_gba_rand_num()
{
    return rand(0, 255);
}

function get_time()
{
    return date('Y-m-s h:i:s', time());
}

function print_param($param)
{
    echo "<pre/>";
    var_dump($param);
    die();
}

function get_encode_password(string $password, int $salt = 981004)
{
    return sha1(md5(md5(md5($password.$salt))));
}

function check_same_email(string $email) : bool
{
    $sameEmailAccount =
        \app\tenno\model\Users::where('email', $email)->find();
    return boolval($sameEmailAccount);
}

function check_same_game_id(string $game_id) : bool
{
    $sameGameId =
        \app\tenno\model\Users::where('game_id', $game_id)->find();
    return boolval($sameGameId);
}
